package com.szholly.plug.form.entity;

import java.util.HashMap;

import org.springframework.stereotype.Component;

import com.szholly.utils.spring.SpringBeanFactory;
import com.szholly.data.general.*;
import com.szholly.data.general.metadata.IBaseTable;

/**
 * 表单模型表
 */
@Component("FORM_MODEL")
public class FormModelTable extends InterceptorTableBase  implements IBaseTable{

	public final static String TABLE_NAME = "FORM_MODEL";
	
	/**
	 * single ref
	 */
	public static FormModelTable getSingleRef() {
		return (FormModelTable) SpringBeanFactory.getBean("FORM_MODEL");
	}

	@Override
	public String getMetadataTableName() {
		return TABLE_NAME;
	}

	@Override
	public String getMetadataTableAliasName() {
		return "表单模型表";
	}
	
	private HashMap<String, Field> fields;

	@Override
	protected HashMap<String, Field> fields() {
		if (fields == null) {
			fields = new HashMap<String, Field>();

			Field itemField = new Field();
			itemField.setFieldName(RowBase.FIELD_VERSION);
			itemField.setDataType(GlobalDataType.Int32);
			itemField.setFieldID(2);
			itemField.setFieldAliasName("VERSION");
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(FormModelRow.FIELD_SMcontent);
			itemField.setDataType(GlobalDataType.Text);
			itemField.setFieldID(5);
			itemField.setFieldAliasName("表单模型内容");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(FormModelRow.FIELD_SModelname);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(6);
			itemField.setFieldAliasName("表单模型名称");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(FormModelRow.FIELD_SModelid);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(7);
			itemField.setIsKey(true);
			itemField.setFieldAliasName("表单模型ID");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(FormModelRow.FIELD_MODELINFO);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(7);
			itemField.setIsKey(true);
			itemField.setFieldAliasName("表单模型描述");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
		}
		return fields;
	}

	@Override
	public String getTableGroup() {
		return "表单信息";
	}
	
	@Override
	public String getCodeFieldName() {
		return FormModelRow.FIELD_SModelid;
	}

	@Override
	public String getCaptionFieldName() {
		return FormModelRow.FIELD_SModelname;
	}

	@Override
	public boolean getIsCodeTable() {
		return true;
	}
	
	@Override
	public boolean getIsManageCodeTable(){
		return false;
	}
	
	@Override
	public String getGUIDFieldName(){
		return FormModelRow.FIELD_SModelid;
	}
}